﻿/**********************************************************************
* @file   FITKAcousticsMaterialMgrAdaptor.h
* @brief  物理属性读写适配器
* @author yangjing (1195810980@qq.com)
* @date   2025-02-25
*********************************************************************/
#ifndef _FITK_ACOUSTICS_PHYSICE_MGRADAPTOR_H__
#define _FITK_ACOUSTICS_PHYSICE_MGRADAPTOR_H__

#include "FITKAcousticsAbstractAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Component/FITKAcousticsPhysics/FITKAcousticsAbsPhysicsProp.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include <QList>
#include <H5Cpp.h>
namespace IO {
    class FITKHDF5FileTool;
    class FITKAcousticsAbsPhysicsProp;
}
namespace IO
{
    //物理属性适配器
    class FITKAcousticsHDF5IOAPI FITKAcousticsPhysicsMgrAdaptor : public FITKAcousticsAbsAdaptor
    {
    public:
        explicit FITKAcousticsPhysicsMgrAdaptor() = default;
        virtual ~FITKAcousticsPhysicsMgrAdaptor() = default;

        virtual bool adaptR() override;

        virtual bool adaptW() override;

    private:
        /**
        * @brief 写梁数据到hdf5
        * @param @param[i]  MaterialGroup hdf5组别
        * @param @param[i]  Beams        梁数据
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-25
        */
        bool writeBeams(H5::Group &PhysicsPropGroup, QList<Acoustics::FITKAcousticsAbsPhysicsProp*>Beams);

        /**
        * @brief 读梁数到数据仓库
        * @param @param[i]  PhysicsPropGroup hdf5组别
        * @param @param[i]  mager管理器
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-23
        */
        bool readBeams(H5::Group &PhysicsPropGroup, Acoustics::FITKAcousticsPhysicsPropManager*mager);




        /**
        * @brief 写均质板数据到数据仓库
        * @param @param[i]  PhysicsPropGroup hdf5组别
        * @param @param[i]  UniformPlats数据
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-25
        */
        bool writeUniformPlats(H5::Group &PhysicsPropGroup, QList<Acoustics::FITKAcousticsAbsPhysicsProp*>UniformPlats);



        /**
        * @brief 读均质板数据到hdf5
        * @param @param[i]  PhysicsPropGroup hdf5组别
        * @param @param[i]  mager管理器
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-25
        */
        bool readUniformPlats(H5::Group &PhysicsPropGroup, Acoustics::FITKAcousticsPhysicsPropManager*mager);



        /**
        * @brief 写普通层压板数据到数据仓库
        * @param @param[i]  PhysicsPropGroup hdf5组别
        * @param @param[i]  GeneralLaminates数据
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-25
        */
        bool writeGeneralLaminate(H5::Group &PhysicsPropGroup, QList<Acoustics::FITKAcousticsAbsPhysicsProp*>GeneralLaminates);


        /**
        * @brief 读普通层压板数据到hdf5
        * @param @param[i]  PhysicsPropGroup hdf5组别
        * @param @param[i]  mager管理器
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-25
        */
        bool readGeneralLaminate(H5::Group &PhysicsPropGroup, Acoustics::FITKAcousticsPhysicsPropManager*mager);



        /**
        * @brief 写加强筋数据到hdf5
        * @param @param[i]  PhysicsPropGroup hdf5组别
        * @param @param[i]  Ribbedphysicals数据
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-25
        */
        bool writeRibbedphysical(H5::Group & PhysicsPropGroup, QList<Acoustics::FITKAcousticsAbsPhysicsProp*> Ribbedphysicals);


        /**
        * @brief 读加强筋数据
        * @param @param[i]  PhysicsPropGroup hdf5组别
        * @param @param[i]  mager管理器
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-25
        */
        bool readRibbedphysical(H5::Group &PhysicsPropGroup, Acoustics::FITKAcousticsPhysicsPropManager*mager);

        /**
        * @brief 判断是否全部为true
        * @param @param[i]  Data 数组
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-19
        */
        bool areAllTrue(const std::vector<bool>& Data);

        /**
        * @brief检查是否含有特殊字符，没有则直接返回，有则转换
        * @param @param[i]  data 检查的字符串
        * @author yangjing (1195810980@qq.com)
        * @date 2024-12-19
        */
        QString RestoreStr(std::string data);


    private:
        IO::FITKHDF5FileTool*m_toolp{ nullptr };
    };

    Register2FITKIOAdaptorFactory(FITKAcousticsHDF5, Acoustics::FITKAcousticsPhysicsPropManager, FITKAcousticsPhysicsMgrAdaptor);
}


#endif
